package com.chushouya.order.constants;

import com.general.framework.core.enums.IEnum;
import com.general.framework.core.lang.Strings;

import java.util.Objects;

//

public enum OrderActionEnum implements IEnum<Integer> {
    CONFIRM_ORDER(1, "确认订单"),
    FOLLOW_ORDER(2, "跟进订单"),
    SEND_SMS(3, "发送短信"),
    UPDATE_ORDER(4, "修改订单"),
    NEXT_ORDER(5, "在下一单"),
    SAVE_CERTIFICATE(6, "保存证件"),

    CALL_ORDER(7, "客服外呼"),
    CANCEL_ORDER(20, "取消订单"),
    CLOSE_ORDER(21, "关闭订单"),
    BACKOUT_ORDER(22, "撤单"),
    RECEIVE_ORDER(31, "确认收货"),
    RESERVE_ORDER(32, "预约快递"),
    RETURN_ORDER(33, "操作退货"),
    //delivery
    DELIVERY_ORDER(34, "确认发货"),
    //物流信息
    LOGISTICS_INFO(35, "物流信息"),
    //退货重新议价
    RETURN_AGAIN(36, "退货重新议价"),


    COMPLETE_ORDER(100, "订单完成"),
    IN_STORAGE(101, "入库操作"),
    SEND_COMPANY(102, "发公司"),
    SELL_OUT(103, "售出操作"),
    STOCK_STORAGE(104, "库存调整"),
    BACK_STORAGE(105, "库存退回"),
    SELF_SELL(106, "自卖操作"),
    //订单结算
    PARTNER_SETTLE(110, "合作商结算"),
    //业务员结算
    CLERK_SETTLE(111, "业务员结算"),
    //客服结算
    KEFU_SETTLE(112, "客服结算"),



    DISPATCH_ORDER(40, "操作发单"),
    ACCEPT_ORDER(41, "工程师接单"),
    //业务员上门
    VISIT_ORDER(42, "业务员上门"),
    QUALITY_ACCEPT_ORDER(43, "质检师接单"),
    PAY_ORDER(50, "支付订单"),
    DEDUCT_ORDER(51, "信用扣款"),
    PAY_PREPAY_ORDER(52, "支付预付款"),
    //支付佣金
    PAY_COMMISSION_ORDER(53, "支付佣金"),

    //钱包支付
    WALLET_PAY_ORDER(55, "钱包支付"),
    //钱包扣款
    WALLET_DEDUCT_ORDER(54, "钱包扣款"),
    //重置订单
    RESET_ORDER(60, "重置订单"),
    QUALITY_ORDER(80, "完成质检"),
    COMPLETE_BARGAIN(90, "完成议价"),
    PAYMENT_ORDER(92, "收成打款"),
    REBARGAIN_ORDER(91, "重新议价"),
    //收款方式
    PAYMENT_TYPE(93, "收款方式"),
    //退回重新付款
    RETURN_PAY(94, "退回重新付款"),
    //重发能量
    SEND_ENERGY(95, "重发能量"),
    ;

    private Integer value;

    private String desc;

    OrderActionEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static String getDesc(Integer status) {
        for (OrderActionEnum thisEnum : OrderActionEnum.values()) {
            if (Objects.equals(thisEnum.value, status)) {
                return thisEnum.desc;
            }
        }
        return Strings.EMPTY;
    }

    public Integer getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 通过value取枚举
     *
     * @param value
     * @return
     */
    public static OrderActionEnum getTypeByValue(Integer value) {
        for (OrderActionEnum enums : OrderActionEnum.values()) {
            if (enums.getValue().equals(value)) {
                return enums;
            }
        }
        return null;
    }

    @Override
    public Integer value() {
        return this.value;
    }

    @Override
    public String named() {
        return this.desc;
    }
}
